"""通用配置信息"""

from enum import Enum

from pydantic import BaseModel


class Level(str, Enum):
    INFO = "INFO"
    DEBUG = "DEBUG"
    WARNING = "WARNING"
    ERROR = "ERROR"


class Server(BaseModel):
    ip: str
    port: int


class Log(BaseModel):
    save_path: str  # 日志路径
    level: Level = "INFO"  # 日志等级
    rotation: str | None = "00:00"  # 日志回滚时间
    compression: bool | None = False  # 是否压缩,默认格式为zip
    console_show: bool = False  # 是否输出到控制台
    file_show: bool = True  # 是否输出到日志文件


class GlobalConfig(BaseModel):
    server: Server
    log: Log
